package com.zengqingfa.swagger.demo.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.StringRedisTemplate;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @fileName: HelloController
 * @author: zengqf3
 * @date: 2021-2-10 22:15
 * @description:
 */
@RestController
public class HelloController {

    @Autowired
    StringRedisTemplate redisTemplate;

    @GetMapping("/hello")
    public String hello() {
        return "hello ,docker";
    }

    @GetMapping("/view")
    public String view() {
        Long views = redisTemplate.opsForValue().increment("views");
        return "hello ,zengqingfa,views:" + views;
    }
}
